<?
if (!empty($submit)) {
	include("includes/functions.php");
	
	$mailComments = stripslashes($comments);
	fieldToDB($comments);
	
	$sql = "INSERT into oa_sys_BugReports (
			BugDate,
			Page,
			Comments,
			UID
			) values (
			'$date',
			'$bugPage',
			'$comments',
			'$UID'
			)";
	$result = mysql_db_query($dbname,$sql);
	
	// Get User Name
	$sql = "SELECT UserNameFull, UserEmailAddress from oa_sys_Users2 WHERE User_PID = '$UID'";
	$result = mysql_db_query($dbname,$sql);
	$row = mysql_fetch_row($result);
	$userName = $row[0];
	$userEmail = $row[1];
	
	// Mail me 
	$to      = $mailWebMaster;
	$from    = "From: info@OregonAbility.org";
	$subject = "OA Bug Report";
	
	$message = "User:                 $userName\n";
	$message .= "User Email Address:  $userEmail\n";
	$message .= "Page:                $bugPage\n\n";
	$message .= "----- Comments -----\n".$mailComments."\n\n";
	$message .= "View All Bug Reports: http://www.oregonability.org/new/admin/bug_report2.php";
	
	mail($to,$subject,$message,$from);
	
}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html>
<head>
	<title>Bug Reports</title>
	<link rel="STYLESHEET" href="styles/layout.css">
</head>

<body topmargin="0" leftmargin="0">
<form action="<?=$PHP_SELF; ?>?page=<?=$page; ?>&submit=1" method="POST">
<input type="hidden" name="bugPage" value="<?=$bugPage; ?>">
<input type="hidden" name="date" value="<? echo date('Y-m-d'); ?>">

<table border="0" width="100%">
<tr>
	<td>
	<? if (!empty($submit)) { echo "<font color=red>Bug Report Submitted</font>\n"; }
	else { echo "Enter Comments:"; } ?>
	<br>
	<textarea name="comments" rows="7" cols="22"></textarea><br>
	<input type="submit" value="Send">
	</td>
</tr>
</table>

</form>

</body>
</html>